package com.dubbo.mapper;

import com.alibaba.dubbo.config.annotation.Service;
import com.dubbo.domain.Article;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

//@Service
public interface ArticleMapper extends Mapper<Article>{

	/**
	 * 根据文章类型获取文章
	 * @author wujunyuan
	 * @date 2018年12月26日  上午10:30:52
	 * @param request
	 * @param type 1=关于狮盾 2=售后说明
	 * @return
	 */
	@Select("SELECT " +
			"	aae.title, " + 
			"	aae.content, " + 
			"	aae.picture, " + 
			"	aae.addTime " + 
			"FROM " + 
			"	a_article aae " + 
			"WHERE " + 
			"	aae.type = #{type}")
	List<Map<String, Object>> getArticleByType(@Param("type") Integer type);

	/**
	 * 根据文章id获取文章图片详情
	 * @author wujunyuan
	 * @date 2018年12月27日  下午3:49:57
	 * @param articleId 文章id
	 * @return
	 */
	@Select("SELECT " +
			"	aae.id, " + 
			"	aae.title, " + 
			"	aae.content " + 
			"FROM " + 
			"	a_article aae " + 
			"WHERE " + 
			"	aae.id = #{articleId}")
	Map<String, Object> getArticleById(@Param("articleId") String articleId);

}